import request from '@/utils/request'

// 查询岗位列表
export function listPost(query) {
  return request({
    url: '/syl_Sxl/user/list',
    method: 'get',
    params: query
  })
}

// 查询部门下拉树结构
export function treeselect() {
  return request({
    url: '/syl_Sxl/syldept/selectAll',
    method: 'get'
  })
}

// 查询岗位详细
export function getPost(postId) {
  return request({
    url: '/syl_Sxl/user/' + postId,
    method: 'get'
  })
}

// 新增岗位
export function addUser(data) {
  return request({
    url: '/syl_Sxl/user',
    method: 'post',
    data: data
  })
}

// 用户密码重置
export function resetUserPwd(userId, userPassword) {
  const data = {
    userId,
    userPassword
  }
  return request({
    url: '/syl_Sxl/user/resetPwd',
    method: 'put',
    data: data
  })
}
// 修改岗位
export function updateUser(data) {
  return request({
    url: '/syl_Sxl/user',
    method: 'put',
    data: data
  })
}

// 删除岗位
export function delPost(postId) {
  return request({
    url: '/syl_Sxl/user/' + postId,
    method: 'delete'
  })
}

// 导出岗位
export function exportPost(query) {
  return request({
    url: '/syl_Sxl/dept/export',
    method: 'get',
    params: query
  })
}

// 新增用户角色
export function addUserRole(data) {
  return request({
    url: '/syl_Sxl/userRole',
    method: 'post',
    data: data
  })
}
